package org.streets.workflow.engine.mem;

import java.io.Serializable;

import org.streets.workflow.engine.IJoinPoint;
import org.streets.workflow.engine.IProcessInstance;
import org.streets.workflow.engine.entities.ProcessInstance;


/**
 * 
 */
@SuppressWarnings("serial")
public class JoinPoint implements IJoinPoint, Serializable {

	private String id; //TODO wmj2003 这个id有用吗？
	private String syncRouterId;
	private Integer value;
	private Boolean alive = Boolean.FALSE;
	private String instanceId = null;
	private transient IProcessInstance processInstance;

	private Integer stepNumber = null;

	private String fromActivityId = null;

	public JoinPoint() {
	}

	public JoinPoint(ProcessInstance processInstance) {
		this.processInstance = processInstance;
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getSyncRouterId() {
		return this.syncRouterId;
	}

	public void setSyncRouterId(String synchronizerId) {
		this.syncRouterId = synchronizerId;
	}

	public Integer getValue() {
		return this.value;
	}

	public void setValue(Integer value) {
		this.value = value;
	}

	public void addValue(Integer v) {
		if (this.value == null) {
			this.value = v;
		} else {
			this.value = new Integer(this.value.intValue() + v.intValue());
		}
	}

	public Boolean getAlive() {
		return this.alive;
	}

	public void setAlive(Boolean alive) {
		this.alive = alive;
	}

	public IProcessInstance getProcess() {
		return this.processInstance;
	}

	public String getProcessId() {
		return instanceId;
	}

	public void setProcessId(String instanceId) {
		this.instanceId = instanceId;
	}


	public void setProcess(IProcessInstance processInstance) {
		this.processInstance = processInstance;
		if (this.processInstance != null) {
			this.instanceId = processInstance.getId();
		} else {
			this.instanceId = null;
		}
	}

	public Integer getStepNumber() {
		return this.stepNumber;
	}

	public void setStepNumber(Integer i) {
		this.stepNumber = i;
	}

	public String getFromActivityId() {
		return this.fromActivityId;
	}

	public void setFromActivityId(String s) {
		this.fromActivityId = s;
	}
}
